(function(Vue, window, document, $) {
  Vue.mixins = Vue.mixins || {};
  Vue.mixins.formPage = {
    host: localStorage['setting:host'],
    created: function() {
      var self = this;
      this.load();
    },
    attached: function() {
      mui.init({});
      $('.mui-scroll-wrapper').scroll({
        bounce: false,
        indicators: true //是否显示滚动条
      });
    },
    events: {
      refresh: 'load',
      show: function() {
        localStorage['$webview:' + window.__WebVieW_Id__ + ':readyShow'] = true;
      }
    },
    methods: {
      load: function() {
        var self = this;
        $.ajax(self.$options.host + self.$options.modelPath, {
          timeout: 2000,
          data: {
            _start: self.start,
            _limit: self.limit,
          },
          success: function(data) {
            vm.list = _.uniq(data.concat(vm.list), 'id');
            vm.start += data.length;
          },
          error: function(xhr, type, errorThrown) {
            $.plusReady(function() {
              plus.nativeUI.alert('连接服务器异常');
            });
          }
        });
      },
    },
  }
})(Vue, window, document, mui);